var rp = require('request-promise')
let uri = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=33_bTqv7LTif0i1GVZpsEDDOGBdnZGivWdj6obecw8APuFem90VEYzaZmJl67OBh_yJC_3eP-IuO9Lqtj2FZ9et1pk4EAiqRlgC9XgmeMzoLQGIQ8xdt9i9urQaOSyL_Ob_bSBHD2c_XOuY7_8CCYUcAJAXTP '

const access_token = `
33_Lmv8qLmAa88Pokz2LlDEVa9BQjbE15pr2BXclrjEjECgXJKGji__11jaorRclx6Ck53zDaGTpLdECa_bVdjZaCTa8K1l2bbgql-MTJrb5zUpIghVm-3NE-yg7ELAYgs3XFuUMeybjR86FFsZMCRhAAAXNC

`
let options ={
    method:'POST',
    uri:uri,
    body:{
        "button": [
            {
                "name": "扫码", 
                "sub_button": [
                    {
                        "type": "scancode_waitmsg", 
                        "name": "扫码带提示", 
                        "key": "rselfmenu_0_0", 
                        "sub_button": [ ]
                    }, 
                    {
                        "type": "scancode_push", 
                        "name": "扫码推事件", 
                        "key": "rselfmenu_0_1", 
                        "sub_button": [ ]
                    }
                ]
            }, 
        ] 
    },
    json:true
   
}
// rp(options).then(res=>{
//     console.log(res);
    
// })
// 33_bTqv7LTif0i1GVZpsEDDOGBdnZGivWdj6obecw8APuFem90VEYzaZmJl67OBh_yJC_3eP-IuO9Lqtj2FZ9et1pk4EAiqRlgC9XgmeMzoLQGIQ8xdt9i9urQaOSyL_Ob_bSBHD2c_XOuY7_8CCYUcAJAXTP

// let getUrl = `https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=${access_token}`
// rp(getUrl).then(res=>{
//     console.log(res);
    
// })
let appId = 'wxda7dc2c44a500981'
let secret = '1e9bf1c457a6d203e92f770aad0624d7'
let code = '01119YIF11CmG60StOJF1so0JF119YIW'
let url = `https://api.weixin.qq.com/sns/oauth2/access_token?appid=${appId}&secret=${secret}&code=${code}&grant_type=authorization_code`
// rp(url).then(res=>{
//     console.log(JSON.parse(res));
    
// })
rp('https://api.weixin.qq.com/sns/userinfo?access_token=33_60rLa91U3hZ0txof5yzb3_cYrILnTX4OVptDI9MsuS-2uoGqphqStCWuBiOJ--plDA4BtAyjllN9OposwLnO40-_9rrP6NG8nE6MJPx6KEDG2hzBQyTvyl8aRi9zT0PsPt_Qjf5YoRRBfnd1CGGcAEATXX').then(res=>{
    console.log(JSON.parse(res));
})